-- ADMIN TOYS FUNCTIONS
function toys_reset(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({jump = 1, gravity = 1, speed = 1})
      minetest.chat_send_player(name, "Reset physics of " .. players[i])
    end
end

function toys_glide(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({jump = 0.3, gravity = 0.1})
      minetest.chat_send_player(name, "Gave glidability to " .. players[i])
    end
  end

function toys_control(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({speed = -1})
      minetest.chat_send_player(name, "Gave antispeed to " .. players[i])
    end
end

function toys_fast(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({speed = 10})
      minetest.chat_send_player(name, "Gave superspeed to " .. players[i])
    end
end

function toys_jump(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({jump = 1000})
      minetest.chat_send_player(name, "Gave sumperjump to " .. players[i])
    end
end

function toys_freeze(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({jump = 0, speed = 0})
      minetest.chat_send_player(name, "Froze " .. players[i])
    end
end

function toys_antigravity(name, param)
    if param == nil then
      param = name
    end
    players = string.split(param,",");
    for i=1,#players do
      local currplayer = minetest.get_player_by_name(players[i]);
      currplayer:set_physics_override({gravity = -0.1})
      minetest.chat_send_player(name, "Gave antigravity to " .. players[i])
    end
end

